<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JS自定义对象</title>
</head>
<body>
<script>
    // JS自定义对象
    let person = {
        name:"张三",
        age:18,
        eat:function () {
            document.write("吃饭");
        },
        sleep:function (hour) {
            document.write("睡"+hour+"小时");
        }
    }
    
    document.write("person的名字为"+person.name);
    document.write("<br>");
    document.write("person的年龄为"+person.age);
    document.write("<br>");

    person.eat()
    document.write("<br>");
    person.sleep(10)
    document.write("<br>");


</script>
</body>
</html>